﻿@model EGEHaina.Areas.People.Models.CompanyType
<script type="text/javascript">
    $(document).ready(function () {
        if ($.fn.customFileInput) {
            $("input[type='file']").customFileInput();
        }
    });
    com.as.CompanyType.prototype.dialogButtons = {
			Update: function() {
			$.ajax({
				url: "/people/companytype/updatesave",
				type: "POST",
				dataType : 'json',
				data: $('#mws-validate').serialize(),
				beforeSend : function(XMLHttpRequest){
					validator.form();
					if ( !validator.valid() ) {
						return false;
					}
					dialogForm.dialog('close');
					com.as.CompanyType.prototype.processingDisplay(true);
					return true;
				},
				success : function(data, textStatus, XMLHttpRequest) {
					if (textStatus == 'success') {
						if ( data.success ) {
							table.fnDraw();
							alert.show(data.message);
						} else {
							alert.show(data.message, {header : com.as.Alert.FAILURE});
						}
					}
				},
				complete : function(jqXHR, textStatus) {
				    com.as.CompanyType.prototype.processingDisplay(false);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					dialogForm.dialog('close');
					alert.show(errorThrown,{header : com.as.Alert.ERROR});
				}
			});
		},
		"Cancel": function() {
			$(this).dialog("close");
		}
	};
</script>

<div class="mws-panel grid_4">
    <div class="mws-panel-header">
        <span class="mws-i-24 i-alert">Update Company Type</span>
    </div>
    <div class="mws-panel-body">
        <div class="mws-panel-content">
            <div id="mws-form-dialog" title="Update Company Type">
                @using(Html.BeginForm("UpdateSave", "CompanyType", FormMethod.Post, new { @class = "mws-form", @id="mws-validate" })) {
                    <div id="mws-validate-error" class="mws-form-message error" style="display:none;"></div>
                    <div class="mws-form-inline">
                        <div class="mws-form-row">
                            @Html.LabelFor(model => model.Name)
                            <div class="mws-form-item large">
                                @Html.HiddenFor(model => model.CompanyTypeId)
                                @Html.TextBoxFor(model => model.Name, new { @class = "mws-textinput required" })
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label>Description</label>
                            <div class="mws-form-item large">
                                @Html.TextAreaFor(model => model.Description, new { @rows = "100%", @cols = "100%"})
                            </div>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>    	
</div>